package com.yxdj.user.api.factory;

import com.yxdj.common.core.domain.R;
import com.yxdj.user.api.RemoteEngineerService;
import com.yxdj.user.api.domain.Engineer;
import org.springframework.cloud.openfeign.FallbackFactory;

public class RemoteEngineerFallbackFactory implements FallbackFactory<RemoteEngineerService> {
    @Override
    public RemoteEngineerService create(Throwable cause) {
        return new RemoteEngineerService() {
            @Override
            public R<Engineer> login(String phone, String source) {
                return R.fail("远程调用用户微服务根据工程师手机号获取工程师信息失败："+cause.getMessage());
            }

            @Override
            public R<Engineer> register(Engineer engineer, String source) {
                return R.fail("远程调用用户微服务注册工程师信息失败："+cause.getMessage());
            }

            @Override
            public R<Engineer> getEngineerById(Long id, String source) {
                return R.fail("远程调用用户微服务根据工程师id获取工程师信息失败："+cause.getMessage());
            }
        };
    }
}
